import numpy as np
import matplotlib.pyplot as plt

a = np.loadtxt('600K_lineshape_verbose.txt',skiprows=1)
A7 = np.loadtxt('ISQWTOT07')
lor15 = np.loadtxt('Lorentzian_Q15.txt')
plt.errorbar(a[:,0],a[:,37],a[:,38],label='Data',color='grey',zorder=0,elinewidth = 2, capsize=3)
plt.plot(a[:,0],a[:,39],label='Fit',zorder=1,lw=3,color='C1')
plt.plot(a[:,0],a[:,40],label='Resolution',color='C0',lw=2)
plt.plot(a[:,0],a[:,41],label='Background',color='black',ls='dashed',lw=2)
plt.plot(a[:,0],a[:,42],label='Lorentzian',color='red',lw=3)
#plt.plot(A7[:,0]*1000,A7[:,1]/np.max(A7[:,1])*np.max(a[:,30]),label='MLMD',color='green',zorder=0,marker='o')
plt.plot(lor15[:,0]*1000,lor15[:,1]/np.max(lor15[:,1])*np.max(a[:,42]),label='MLMD',color='green',zorder=0,marker='o',markersize=3)

plt.xlim(-100,100)
plt.ylim(0,0.001)
plt.yticks([0.000,0.005,0.010])
plt.xlabel(r'Energy ($\mu$eV)',fontsize=20)
plt.ylabel('Intensity (a.u.)',fontsize=20)
plt.tick_params(which='both',direction='in',labelsize=20,pad=6)
plt.title(r'600K Q=1.5$\pm$0.1 $\rm{\AA^{-1}}$',fontsize=20)
plt.legend(frameon=False,fontsize=18,handlelength=1,loc='upper left')
#plt.savefig('Spectrum_600K_1p5_v5.pdf',format='pdf',bbox_inches='tight')
plt.show()

